This document is designed to give programmers some brief technical information about the MathGV 4.1 source code.
Copyright 1999-2011 Greg VanMullem
This program is distributed under the terms of the GNU General Public License Version 3
For more information visit: www.MathGV.com


MathGV is compiled with Delphi 2007 Professional. MathGV is a modern threaded 32-bit application designed for Windows XP, Vista and Windows 7. It should compile with newer versions of Delphi but I have not tested that. Yes, I know I need to upgrade soon. The MathGV Help file was built with the Microsoft Help Workshop version 4.74. The MathGV installer is a standard Windows Installer MSI file. I built it with Visual Studio 2010 Professional.

The MathGV program uses a few custom controls located in mgvcustm.dprj that need to be installed into Delphi before you can compile MathGV. These custom controls were written by me and are covered under the same license as the main MathGV project. No third party controls or code are used in MathGV. I only used the basic components that come with the Delphi VCL.

MathGV was originally developed under DOS and Windows 3.1. The only remnant of these older systems left is the 8.3 file naming convention still used in the source code files. Im renaming all the source files in the next version.

MathGV uses an INI file to store its settings. The INI file is well documented in the MathGV help file. Im thinking about moving this data to the system registry in a future version.

MathGV is an MDI (Multiple Document Interface) application. MathGV contains a number of strategic limits on graph window count and size that are designed to prevent users from hitting the 2 gigabyte memory limit on all 32-bit Windows programs.

MathGV uses a unique function parsing and evaluation engine that I wrote back in the DOS days. Its highly optimized for function graphing and uses a post fix notation algorithm. The calculation engine does Extended type 10-byte floating point and 64-bit integer fraction calculations at the same time. This allows MathGV to give exact fractional results like 1/3 instead of rounded results like .333333333. A large array of prime numbers is used to quickly reduce fractions. Check out the calculator dialog box to see how this works. The 3D calculations are done using fixed point 32-bit integers in assemble language (an old school video game programming trick). All assembly language functions have a Pascal equivalent that is remarked. The Pascal functions can be used for testing or a quick bug fix if something goes wrong with assemble language functions.

MathGV allows graphs to be saved in a custom data file format with the file extension .mgf. These files allow full backward compatibility with older versions of MathGV including the original 16-bit version 1. The data files contain a header with version information. At the end of the file is a 16 bit check sum used to smoothly detect corrupted data files. I wish more programs would do this instead of crashing! When MathGV loads a data file all values are recalculated using the original function/expression strings that the user entered. This is done because different CPUs will occasionally give different rounding results, so I want to rest all the values for the current CPU.

Each graph window uses 2 threads and 4 bitmap buffers. The threads do graph rendering and label rendering. These threads can operate independently and simultaneously. Two copies of all the data necessary to render a graph are maintained in memory at all times. This allows the threads to run at the same time the user is editing the graph data using the various dialog boxes.

The following is an object inheritance list that I wrote for my own use a long time ago. Each object inheritance level references or used the corresponding level in the other objects.

TPlotGraph = class
	TPlotGraphFuncList
		TPlotGraph2D
		TPlotGraphPolar
		TPlotGraph3D

TPlotThread = class
	TPlotThreadPicture
	TPlotThreadGraph
		TPlotThreadFuncList
			TPlotThread2D
			TPlotThreadPolar
			TPlotThread3D

TPlotImageBox = class(TScrollBox)
	TImagePicture
	TPlotImageGraph
		TPlotImageFuncList
			TImage2D
			TImagePolar
			TImage3D

TWindowBase = class(TForm)
	TWindowGraph
		TWindow2D
		TWindowPolar
		TWindow3D

Thanks,
Greg VanMullem

